package cn.wbnyua.resume.mvc.service.v2;

import cn.wbnyua.resume.core.exception.RuntimeExceptionHandler;
import cn.wbnyua.resume.mvc.domain.MySelf;
import cn.wbnyua.resume.mvc.mapper.MySelfMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 作者：wbnyua.
 * 创建时间: 2023/2/6 22:01.
 */

@Service
public class MySelfService {

    @Autowired
    private MySelfMapper mapper;


    public MySelf find(){
        return mapper.find();
    }

    public int update(MySelf mySelf){
        return mapper.update(mySelf);
    }

    public MySelf findByAccount(String account){
        return mapper.findByAccount(account);
    }

    public boolean login(String account, String password) {
        MySelf mySelf = mapper.findByAccount(account);
        if (mySelf==null){
            throw new RuntimeExceptionHandler("用户名或密码错误");
        }
        return true;
    }

}
